<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
{#    <script src="../static/jquery.js"></script>#}
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<form action="" method="post" class="form-inline">
    <table class="table table-striped">
        <tr>
            <td colspan="5">
                    物资类型:<select name="type" id="">
                                <option value="全部">全部</option>
                                {% for protype in protype_list %}
                                    <option value="{{ protype.id }}">{{ protype.name }}</option>
                                {% endfor %}
                            </select>
                &nbsp;&nbsp;&nbsp;
                物资名称：<input type="text" name="name" class="form-control" id="exampleInputName2" placeholder="Jane Doe">&nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-default">查询</button>&nbsp;&nbsp;&nbsp;<button class="btn btn-default" type="submit"><a
                href="{% url 'insert' %}" style="text-decoration: none;color: black">添加物资</a></button>
            </td>
        </tr>
        <tr align="center" class="info">
            <td>编号</td>
            <td>物资名称</td>
            <td>采购时间</td>
            <td>是否报废</td>
            <td>计量单位</td>
            <td>采购单价</td>
            <td>物资描述</td>
            <td>类型名称</td>
            <td>操作</td>
        </tr>
        {% for proInfo in proInfo_list %}
        <tr align="center">
            <td>{{ proInfo.id }}</td>
            <td>{{ proInfo.name }}</td>
            <td>{{ proInfo.addTime|date:'Y-m-d'}}</td>
            <td>
                {% if proInfo.isdestroy == 1 %}
                    已报废
                {% endif %}
                {% if proInfo.isdestroy == 0 %}
                    未报废
                {% endif %}
            </td>
            <td>{{ proInfo.unit }}</td>
            <td>{{ proInfo.price }}</td>
            <td>{{ proInfo.description}}</td>
            <td>{{ proInfo.type.name }}</td>
            <td>
                {% if proInfo.isdestroy == 0 %}
                    <a href="{% url 'update' id=proInfo.id %}" id="d1">报废</a>
                {% endif %}
            </td>
        </tr>
        {% endfor %}

    {% for proInfo in gg %}
        <tr align="center">
            <td>{{ proInfo.id }}</td>
            <td>{{ proInfo.name }}</td>
            <td>{{ proInfo.addTime|date:'Y-m-d'}}</td>
            <td>
                {% if proInfo.isdestroy == 1 %}
                    已报废
                {% endif %}
                {% if proInfo.isdestroy == 0 %}
                    未报废
                {% endif %}
            </td>
            <td>{{ proInfo.unit }}</td>
            <td>{{ proInfo.price }}</td>
            <td>{{ proInfo.description}}</td>
            <td>{{ proInfo.type.name }}</td>
            <td>
                {% if proInfo.isdestroy == 0 %}
                    <a href="{% url 'update' id=proInfo.id %}" id="d1">报废</a>
                {% endif %}
            </td>
        </tr>
        {% endfor %}
    </table>
</form>
<script>
    window.onload=function(){
     var mylink=document.getElementById("d1");
     mylink.onclick=function(){
      if(confirm("确定要报废此物资"))
      {
        return true;
      }
      else
      {

        return false;
      }
     }
    }
</script>
</body>
</html>